package net.ebakker.feededitor.compose;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.json.JSONException;
import org.json.JSONObject;

public class FeedComposer {

	public String compose(ResultSet rs) throws JSONException, SQLException {
		String array = "[";
		while (rs.next()) {
			JSONObject jsonFeed = new JSONObject();
			jsonFeed.put("id", rs.getInt(1));
			jsonFeed.put("title", rs.getString(2));
			array += jsonFeed.toString() + ",";
		}
		return array.substring(0, array.length() - 1) + "]";
	}
}
